/**
  ******************************************************************************
  * File Name          : wheel.h
  * Description        :
  ******************************************************************************
  */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __BLUETOOTH_H
#define __BLUETOOTH_H
#include "main.h"
#include "stm32f1xx_hal.h"
#include "cmsis_os.h"

#define USART_BUF_SIZE  100
typedef enum 
{
    COMMAND_NOTHING = 0,
	CMD_BLUETOOTH_OPEN,
	CMD_BLUETOOTH_CLOSE,
	CMD_BLUETOOTH_FORWARD,
	CMD_BLUETOOTH_BACKWARD,
	CMD_BLUETOOTH_CCW,
	CMD_BLUETOOTH_CW,
	CMD_BLUETOOTH_SHIFTLEFT,
	CMD_BLUETOOTH_SHIFTRIGHT,
	
	CMD_ERROR = 255
    
}Bluetooth_Command_Action;

typedef struct
{
  Bluetooth_Command_Action  action;
	uint8_t			error_code;
	int speed_amount;

	
} T_Command;

typedef enum
{
	SPIN_MODE=1,
	SHIFT_MODE,
	NOTHING=100

}Joystick_Mode;

typedef struct
{
	int Radius_Left,Radius_Right;
	int Angle_Left,Angle_Right;
	Bluetooth_Command_Action action;
	Joystick_Mode mode;
	
}Joystick_Command;



typedef struct
{
    uint8_t rx_data;
    uint8_t rx_index;
    uint8_t rx_buffer[USART_BUF_SIZE];
    uint8_t rx_complete;
}T_USART_Buffer;


int usart3_reset_buffer (void);
int usart3_enqueue_to_buffer (uint8_t data);
T_Command lscm_parse_received_command_usart3 (void);
void UART3_Printf(const char* format,...);
Joystick_Command lscm_parse_received_command_usart3_joystick (void);
static Joystick_Command _parse_usart3_joystick_command (char *str);


extern T_USART_Buffer usart3;
#endif

